<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>费用定义修改</title>
    <script type="text/javascript">
    
   		
    	$().ready(function(){
    		var map = Dialog.getInstance("view").getParam("param");
    		if(map != null)
    		{
    			Form.bindForm("winForm",map);
    			
    			var person_type = "";
    			switch(map['person_type'])
    			{
    				case '0' : person_type="参保学生"; break;
    				case '1' : person_type="教职工"; break;
    				case '2' : person_type="退休人员"; break;
    				case '3' : person_type="离休人员"; break;
    				case '4' : person_type="其他人员"; break;
    			}
    			
    			$("#person_type").val(person_type);
    			
    			if(map['register_type'] == "0"){
    				$("#register_type").val("普通");
    			}else{
    				$("#register_type").val("急诊");
    			}
    		}
    	});
    	
    	
    	function doSave()
    	{
    		if(doCheck())
    		{
    			var map = Form.formToBean("winForm");
        		ajax.remoteCall("com.system.dao.CostDefinitionDao:update",[map],function(reply){
        			var result = reply.getResult();
        			alert(result.value);
        			if(result.type == "success")
        			{
        				var dlg = Dialog.getInstance("view");
        	    		dlg.getParam("window").mygrid.reload();
        	    		dlg.close();
        			}
        		});
    		}
    	}
    	
    	function doCheck()
    	{
    		if(!check_integer($.trim($("#percentage").val())))
    		{
    			alert("收费比例须为数字");
    			return false;
    		}
    		
    		if(!check_integer($.trim($("#register_amount").val())))
    		{
    			alert("挂号费用须为数字");
    			return false;
    		}
    		
    		if(!check_integer($.trim($("#max_consume").val())))
    		{
    			alert("单次最大消费须为数字");
    			return false;
    		}
    		
    		return true;
    	}
    </script>
  </head>
  <body>
  	<form id="winForm">
  		<input type="hidden" name="id" />
		<table border="0" cellpadding="0" cellspacing="0">
			<tr height="40px">
				<td width="100px" align="right">病人类型：</td>
				<td width="140px"><input id="person_type" name="person_type" type="text" readonly class="textbox" style="width: 140px;color: blue;"/></td>
				<td width="120px" align="right"><span style="color: red;">*</span>收费比例(%)：</td>
				<td width="140px"><input id="percentage" name="percentage" type="text" class="textbox" style="width: 135px;"/></td>
			</tr>
			<tr height="40px">
				<td width="100px" align="right">挂号类型：</td>
				<td width="140px"><input id="register_type" name="register_type" readonly type="text" class="textbox" style="width: 140px;color: blue;"/></td>
				<td width="120px" align="right"><span style="color: red;">*</span>单次最大消费：</td>
				<td width="140px"><input id="max_consume" name="max_consume" type="text" class="textbox" style="width: 135px;"/></td>
			</tr>
			<tr height="40px">
				<td width="100px" align="right"><span style="color: red;">*</span>挂号费：</td>
				<td width="140px" colspan="3"><input id="register_amount" name="register_amount" type="text" class="textbox" style="width: 140px;color: blue;"/></td>
			</tr>
			<tr height="50px" valign="top">
				<td width="100px" align="right">定义描述：</td>
				<td colspan="3">
					<textarea name="notes" rows="6" cols="49"></textarea>
				</td>
			</tr>
	  	</table>
  	</form>
  </body>
</html>
